﻿@{
    var password = ViewData.Get<string>("passWord", string.Empty);
    var name = ViewData.Get<string>("name", "PassWord");
    var isClear = ViewData.Get<bool>("isClear", false);
    var passwordTitle = ViewData.Get<string>("PassWordTitle", "密码");

}
@if (isClear)
{
    <label>@(passwordTitle)</label>

    <input style="padding-right:39px;" class="form-control " data-val="true" data-val-length="字母、数字至少6位,并且不能超过64位" data-val-length-max="64" data-val-length-min="6" data-val-required="请输入密码" type="text" value="@password" name="@name" id="@name">
}
else
{
    <label>@(passwordTitle)</label>
    <input style="padding-right:39px;" class="form-control" data-val="true" data-val-length="字母、数字至少6位,并且不能超过64位" data-val-length-max="64" data-val-length-min="6" data-val-required="请输入密码" type="password" value="@password" name="@name" id="@name">
}

<script>
   require(['jquery'],function(){

   

    $(document).off("click", "input.tn-click-eye").on("click", "input.tn-click-eye", function() {
        var t = new Date().getTime();
        var $this = $(this);
        var isClear = true;
        var password = $this.siblings("input").val();
        var id = $this.parent().attr("id");
        var type = $this.siblings("input").attr("type");
        var name = $this.siblings("input").attr("name")

        if (type == "text") {
            isClear = false;
            $($this.siblings("span").first()).children().attr("class", "fa fa-eye-slash");
        } else {
            $($this.siblings("span").first()).children().attr("class", "fa fa-eye");
        }
        $.get("@SiteUrls.Instance()._PassWordPoclaimed()", { passWord: password, name: name, passWordTitle: "@passwordTitle", isClear: isClear, t: t }, function (data) {
            var inputclass = $this.siblings("input").attr("class");
            $this.siblings("input").first().remove();
            $this.siblings("label").first().remove();

            $("#" + id).prepend(data);
            $("#" + name).attr("class", inputclass);
        })
    });

    
    })
</script>
